package com.quanxiaoha.weblog.web.controller;

import com.quanxiaoha.weblog.common.Response;
import com.quanxiaoha.weblog.common.aspect.ApiOperationLog;
import com.quanxiaoha.weblog.web.model.vo.messageWall.AddMessageWallReqVO;
import com.quanxiaoha.weblog.web.model.vo.messageWall.QueryMessageWallListReqVO;
import com.quanxiaoha.weblog.web.service.MessageWallService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/message-wall")
public class MessageWallController {

    @Autowired
    private MessageWallService messageWallService;

    @PostMapping("/add")
    @ApiOperationLog(description = "添加留言")
    public Response addMessage(@RequestBody @Validated AddMessageWallReqVO addMessageWallReqVO) {
        return messageWallService.addMessageWall(addMessageWallReqVO);
    }

    @PostMapping("/list")
    @ApiOperationLog(description = "获取留言列表")
    public Response getMessageList(@RequestBody @Validated QueryMessageWallListReqVO queryMessageWallListReqVO) {
        return messageWallService.queryMessageWallList(queryMessageWallListReqVO);
    }
}